<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>7-调整窗口大小</title>
		<style type="text/css">
			.box{
				width:100px;
				height:100px;
				background:red;
				display:none;
			}
		</style>
	</head>
	<body>
		<div class="box"></div>
		<script type="text/javascript">
			window.addEventListener('resize',function(e){
				console.log(e);
				//获取当前屏幕宽度
				var w = window.innerWidth;
				console.log(w);//没有单位
				if(w<800){
					document.querySelector('.box').style.display='none';
				}else{
					document.querySelector('.box').style.display='block';
				}
			})
		</script>
	</body>
</html>
